{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\myogo\Princeton Dropbox\Motohiro Yogo\Koijen Yogo - International\JPE\Replication\Code\1 Data\GeoDist.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}31 Oct 2025, 09:17:31
{txt}
{com}. /* Set local variables */
> 
> local directory = "../../Data/GeoDist";
{txt}
{com}. /* Load data */
> 
> u iso_o iso_d dist using "`directory'/dist_cepii", clear;
{txt}
{com}. /* Rename variables */
> 
> rename iso_o country;
{res}{txt}
{com}. rename iso_d counterpart;
{res}{txt}
{com}. /* Fix variables */
> 
> foreach var of varlist country counterpart {c -(};
{txt}  2{com}.         replace `var' = "COD" if `var'=="ZAR";
{txt}  3{com}.         /* Democratic Republic of the Congo */
>         replace `var' = "PSE" if `var'=="PAL";
{txt}  4{com}.         /* West Bank and Gaza = Palestine */
>         replace `var' = "ROU" if `var'=="ROM";
{txt}  5{com}.         /* Romania */
>         replace `var' = "SRB" if `var'=="YUG";
{txt}  6{com}.         /* Serbia = Yugoslavia */
>         replace `var' = "TLS" if `var'=="TMP";
{txt}  7{com}.         /* Timor-Leste = East Timor */
> {c )-};
{txt}(224 real changes made)
(224 real changes made)
(224 real changes made)
(224 real changes made)
(224 real changes made)
(224 real changes made)
(224 real changes made)
(224 real changes made)
(224 real changes made)
(224 real changes made)

{com}. /* Convert to 1,000 km */
> 
> replace dist = dist/1e3;
{txt}(50,176 real changes made)

{com}. /* Label variables */
> 
> label var country               "Investor country";
{txt}
{com}. label var counterpart   "Issuer country by nationality";
{txt}
{com}. label var dist                  "Simple distance (1,000 km)";
{txt}
{com}. /* Save data */
> 
> sort country counterpart;
{txt}
{com}. save GeoDist, replace;
{txt}{p 0 4 2}
file {bf}
GeoDist.dta{rm}
saved
{p_end}

{com}. log close;
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\myogo\Princeton Dropbox\Motohiro Yogo\Koijen Yogo - International\JPE\Replication\Code\1 Data\GeoDist.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}31 Oct 2025, 09:17:31
{txt}{.-}
{smcl}
{txt}{sf}{ul off}